import {mapGetters} from 'vuex'
	
export default {
	computed: {
		...mapGetters('m_cart',['total'])
	},
	onShow() { 
		this.setBadge()
	},
	watch:{
		//监听total值的变化
		total(){
			//重新调用setbadge
			this.setBadge()
		}
	},
	methods:{
		setBadge(){
			uni.setTabBarBadge({
				index: 2,
				text: this.total + ''//字符串，不能是数字
			})
		}
	}
}